import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class ToastUtil {
  // 成功
  static void showSuccess(String message) {
    // 显示成功提示信息
    Fluttertoast.showToast(
      msg: message,
      toastLength: Toast.LENGTH_SHORT, // 提示持续时间短
      gravity: ToastGravity.BOTTOM,    // 提示位置在底部
      backgroundColor: Colors.green,   // 背景颜色为绿色
      textColor: Colors.white,         // 文字颜色为白色
      webPosition: 'center',           // Web端位置居中
      webBgColor: '#5591af',          // Web端背景颜色
    );
  }

  // 失败
  static void showError(msg) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      backgroundColor: Colors.green,
      textColor: Colors.white,
      webPosition: 'center',
      webBgColor: '#5591af',
    );
  }

  // 一般情况
  static void showInfo(msg) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      backgroundColor: Colors.green,
      textColor: Colors.white,
      webPosition: 'center',
      webBgColor: '#5591af',
    );
  }
}
